package com.lancoo.cvas.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lancoo.cvas.config.MybatisRedisCache;
import com.lancoo.cvas.entity.Student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lancoo.cvas.pojo.dto.ExcelStudent;
import com.lancoo.cvas.pojo.dto.TeachingClassStudentDto;
import com.lancoo.cvas.pojo.vo.ClassDto;
import com.lancoo.cvas.pojo.vo.ClassDtoVo;
import com.lancoo.cvas.pojo.vo.StudentCourseVo;
import com.lancoo.cvas.pojo.vo.StudentTeachingClass;
import org.apache.ibatis.annotations.CacheNamespace;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * 学生
 * 
 * @author liufeng
 * @email 1037383243@qq.com
 * @date 2023-12-04 11:54:00
 */
@CacheNamespace(implementation = MybatisRedisCache.class, eviction = MybatisRedisCache.class)
public interface StudentMapper extends BaseMapper<Student> {

    void addBatch(List<Student> studentCollection);

    /**
     * 获取学生可选教学班
     * @param teachingClassType
     * @param courseIds
     * @param o
     * @param studentId
     * @return
     */
    List<StudentTeachingClass> getTeachingClass(Integer teachingClassType, List<Long> courseIds, Integer studyNature, Long studentId,String gradeId);

    /**
     * 获取学生重修教学班
     * @param teachingClassType
     * @param courseRetakeIds
     * @param o
     * @param studentId
     * @return
     */
    List<StudentTeachingClass> getRetakeTeachingClass(Integer teachingClassType, List<Long> courseRetakeIds, Integer studyNature, Long studentId);

    /**
     *获取学生课程教学班
     * @param teachingClassIds
     * @return
     */
    List<StudentTeachingClass> getNormalCourseTeachingClass(List<Long> teachingClassIds, Integer teachingClassType);


    /**
     * 获取学生无需选课的环节教学班
     * @param teachingClassIds
     * @return
     */
    List<StudentTeachingClass> getNormalSegmentTeachingClass(List<Long> teachingClassIds);

    /**
     * 根据教学班获取学生
     * @param page
     * @param teachingClassIds
     * @return
     */
    IPage<Student> getStudentByTeachingClassId(Page<Student> page, List<Long> teachingClassIds);

    /**
     * 获取学生选课详情
     * @param taskId
     * @param page
     * @param majorId
     * @param gradeId
     * @param classId
     * @param keyWord
     * @param teachingClassType 0无需选课 1在线选课;
     * @param flag 1已选   2退选   3移除 4退选+移除
     * @param beginTime
     * @return
     */
    IPage<StudentCourseVo> getSelectStudent(Integer taskId, IPage page, String majorId, String gradeId, String classId, String keyWord, Integer teachingClassType, Integer flag, LocalDateTime beginTime);

    /**
     * 根据条件获取全部学生
     * @param taskId
     * @param page
     * @param majorId
     * @param gradeId
     * @param classId
     * @param keyWord
     * @return
     */
    IPage<Student> getStudentByConditions(Integer taskId, IPage page,String gradeId, String classId, String keyWord);

    List<ExcelStudent> getExcelStudent(List<Long> teachingClassIds);

    /**
     * 获取新政班信息
     * @param taskId
     * @param gradeId
     * @param majorId
     * @return
     */
    List<ClassDtoVo> getClassDto(Integer taskId, String gradeId, String majorId);


    /**
     * 获取学生部分信息
     * @param taskId
     * @return
     */
    Set<ExcelStudent> getStudentList(Integer taskId);

    /**
     * 获取基础平台学生id
     * @param taskId
     * @return
     */
    List<TeachingClassStudentDto> selectTeachingClassStudentDto(Integer taskId,List<Long> studentIds);
}
